
/**
 * Sits on top of the game screen, provides info and handles menu ops...
 * 
 * @author ben
 *
 */
public class InfoOverlay extends Screen {

	public int PANELHEIGHT = 100;
	
	// message to the player...?
	public String message = "";	
	
	public InfoOverlay(Carcassonne c)
	{
		super(c);
	}
	
	public void setMessage(String msg)
	{
		message = msg;
	}
	
	public void draw()
	{
		// draw info panel over top
		c.fill(255,255,255,150);
		c.noStroke();
		c.rect(0,height-PANELHEIGHT,width,PANELHEIGHT);

		// meeple box
		// a box that contains the meeple counts for all players

		final int D_MB = 10;
		final int MW = theme.getMeepleImage(0).width;
		final int MB_WIDTH = (int) ((MW + c.textWidth("8") + D_MB)*c.NUMPLAYERS);
		int mbx = D_MB/2;
		int mby = height-PANELHEIGHT;
		for(int i=0;i<c.NUMPLAYERS;i++)
		{
			c.noStroke();
			c.fill(255,255,255,255);
			c.image(theme.getMeepleImage(i),mbx,mby);
			c.fill(0);
			c.text(String.valueOf(c.g.players[i].numberOfMeeplesLeft()),mbx+MW,mby + c.textAscent() + c.textDescent());
			mbx += (MW + c.textWidth("8") + D_MB);
		}

		// draw message
		if (message.length()>0)
		{
			float messagewidth = c.textWidth(message);
			float messageheight = c.textAscent() + c.textDescent();
			c.fill(0);
			c.text(message,(width-messagewidth)/2.f,height-PANELHEIGHT/2.f);
		}
	}
}
